

<ul id="breadcrumb">
	<li>ถาม - ตอบ</li>			
</ul>
<div id="content">
	<a class="button" href="question/form"><span class="icon_text question"></span>ตั้งคำถาม</a><br /><br />
	<table class="list">
		<tr>
			<th width="100">คำถามที่</th>
			<th>คำถาม</th>
			<th width="100">คำตอบ</th>
			<th width="200">ผู้ตั้ง</th>
		</tr>
		<? foreach($result as $item): ?>
		<tr>
			<td class="center"><?php echo $item['id'] ?></td>
			<td>
				<?php echo anchor('question/view/'.$item['id'],$item['title']) ?>
				<?php if($item['user_id']==login_data('id')): ?>
				<span class="option">
					[ <a href="question/form/<?php echo $item['id'] ?>">แก้ไข</a> - 
					<a href="question/delete/<?php echo $item['id'] ?>" onclick="return confirm('ยืนยันการลบคำถาม')" >ลบ</a> ]
				</span>
				<?php endif; ?>
			</td>
			<td class="center"><?php echo get_one('COALESCE(count(id),0)','answers','question_id',$item['id']) ?></td>
			<td class="center"><?php echo get_one('concat(firstname,concat(\' \',lastname))','users','id',$item['user_id']) ?></td>
		</tr>
		<? endforeach; ?>
	</table>
	<?php echo $pagination ?>
</div>
